package com.example.demosecurityjwtlogin.security.services;

import com.example.demosecurityjwtlogin.models.Book;
import com.example.demosecurityjwtlogin.repository.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {
    @Autowired
    BookMapper bookMapper;
    public int addBook(Book book){
        return bookMapper.addBook(book);
    }
    public int deleteBookById(int id){
        return bookMapper.deleteBookById(id);
    }
    public int updateBookById(Book book){
        return  bookMapper.updateBookById(book);
    }
    public List<Book> getAllBook(){
        return bookMapper.getAllBook();
    }
    public Book getBookById(int id){
        return bookMapper.findById(id);
    }

}
